package kr.ac.kd;

import org.json.kd.JSONException;
import org.json.kd.JSONObject;

public class ServerResponse {

	private boolean resultFlag = true;
	private String resultMessage = null;
	private JSONObject result = null;
	private String id = null;
	
	public ServerResponse() {
		super();
	}

	public ServerResponse(String respString) {
		System.out.println("respString : " + respString);
		try {
			result = new JSONObject(respString);
			this.resultFlag = result.getBoolean("resultFlag");
			this.id = result.getString("id");
			this.resultMessage = result.getString("resultMessage");
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public boolean isResultFlag() {
		return resultFlag;
	}

	public void setResultFlag(boolean resultFlag) {
		this.resultFlag = resultFlag;
	}

	public String getResultMessage() {
		return resultMessage;
	}

	public void setResultMessage(String resultMessage) {
		this.resultMessage = resultMessage;
	}

	public JSONObject getResult() {
		return result;
	}

	public void setResult(JSONObject result) {
		this.result = result;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public String toString() {
		return "ServerResponse [resultFlag=" + resultFlag + ", resultMessage="
				+ resultMessage + ", result=" + result + ", id=" + id + "]";
	}

}
